package com.digua.base.socket.dispatcher

import com.digua.base.socket.response.ErrorResponse
import org.java_websocket.framing.Framedata
import java.nio.ByteBuffer

class DefaultResponseDispatcher : IResponseDispatcher {
    override fun onConnected(delivery: ResponseDelivery?) {
        delivery?.onConnected()
    }

    override fun onConnectFailed(cause: Throwable?, delivery: ResponseDelivery?) {
        delivery?.onConnectFailed(cause)
    }

    override fun onDisconnect(delivery: ResponseDelivery?) {
        delivery?.onDisconnect()
    }

    override fun onMessage(message: String, delivery: ResponseDelivery?) {
        delivery?.onMessage(message, null)
    }

    override fun onMessage(byteBuffer: ByteBuffer, delivery: ResponseDelivery?) {
        delivery?.onMessage(byteBuffer, null)
    }

    override fun onPing(framedata: Framedata?, delivery: ResponseDelivery?) {
        delivery?.onPing(framedata)
    }

    override fun onPong(framedata: Framedata?, delivery: ResponseDelivery?) {
        delivery?.onPong(framedata)
    }

    override fun onSendDataError(error: ErrorResponse?, delivery: ResponseDelivery?) {
        delivery?.onSendDataError(error)
    }

}